package com.dhwl.hsh.lib.constant;

import android.text.TextUtils;

import com.dhwl.hsh.lib.utils.ReservoirUtils;

/**
 * 程序全局配置
 *
 * @author Derek.Kidd
 * @version V1.0.0
 * @date 2016/5/26 10:57
 */
public final class GlobalConfig {


    /**
     * 登录回话ID
     */
    public String tokenId;

   private ReservoirUtils reservoirUtils;

    /**
     * 全局配置单实例
     */
    private static GlobalConfig instance = new GlobalConfig();

    private GlobalConfig() {

        reservoirUtils = new ReservoirUtils();
    }

    /**
     * 返回全局配置实例，通过该实例可以返回当前应用程序中其它配置
     *
     * @return
     */
    public static GlobalConfig getInstance() {
        return instance;
    }

    public String getTokenId() {
        if (TextUtils.isEmpty(tokenId)) {
            return "";
        }
        return tokenId;
    }

    public void setTokenId(String tokenId) {
        this.tokenId = tokenId;
    }

    /**
     * 用户是否登录状态
     *
     * @return
     */
    public boolean isLogin() {
        return !TextUtils.isEmpty(getTokenId());
    }
}
